package com.km.team.phsystem.web.controller;

import com.km.team.phsystem.beans.vo.ResponseData;
import com.km.team.phsystem.service.TemporaryAppointmentService;
import com.km.team.phsystem.web.controller.base.BaseController;
import com.km.team.phsystem.web.utils.ResponseDataUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：Riven.
 * @description：
 * @date ：2018/12/5
 */
@RestController
@RequestMapping("temporary")
public class TemporaryAppointmentController extends BaseController<TemporaryAppointmentController> {
    private final TemporaryAppointmentService temporaryAppointmentService;

    @Autowired
    public TemporaryAppointmentController(TemporaryAppointmentService temporaryAppointmentService) {
        this.temporaryAppointmentService = temporaryAppointmentService;
    }
    @ApiOperation(value = "获取业务ID下临时排号信息，同时检查是数据库数据是否已经是上一天的数据，是则初始化数据", notes = "")
    @GetMapping("accept_no/{id}")
    public ResponseData getDateForBusinessId(@PathVariable("id") Integer id) throws Exception {
        return ResponseDataUtil.buildSuccess(this.temporaryAppointmentService.getDateForBusinessId(id));
    }
}
